{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'rule0': TradingRule; function: <function ewmac_forecast_with_defaults at 0x7f4e282cad08>, data:  and other_args: }\n",
      "{'ewmac': TradingRule; function: <function ewmac_forecast_with_defaults at 0x7f4e282cad08>, data:  and other_args: }\n",
      "System with .config, .data, and .stages: rules\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/sysdata/data.py:58: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  dailyprice = instrprice.resample(\"1B\", how=\"last\")\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=128,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:136: FutureWarning: pd.ewm_std is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=35,min_periods=10).std(bias=False)\n",
      "  vol = pd.ewmstd(x, span=days, min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:143: FutureWarning: pd.rolling_quantile is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=100,window=500).quantile(quantile=0.05)\n",
      "  vol, floor_days, floor_min_quant, floor_min_periods)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2016-11-07    0.100716\n",
      "2016-11-08   -0.011247\n",
      "2016-11-09   -0.237658\n",
      "2016-11-10   -0.513974\n",
      "2016-11-11   -0.835147\n",
      "Freq: B, dtype: float64\n",
      "TradingRule; function: <function ewmac_forecast_with_defaults at 0x7f4e282cad08>, data:  and other_args: Lslow, Lfast\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/algos.py:186: FutureWarning: pd.rolling_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=500,window=250000).mean()\n",
      "  avg_abs_value = pd.rolling_mean(x, window=window, min_periods=min_periods)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2016-11-07    2.852933\n",
      "2016-11-08    2.853191\n",
      "2016-11-09    2.853442\n",
      "2016-11-10    2.853675\n",
      "2016-11-11    2.853896\n",
      "Freq: B, dtype: float64\n",
      "2016-11-07    0.266898\n",
      "2016-11-08   -0.029803\n",
      "2016-11-09   -0.629794\n",
      "2016-11-10   -1.362031\n",
      "2016-11-11   -2.213139\n",
      "Freq: B, dtype: float64\n",
      "WARNING: No forecast weights  - using equal weights of 0.5000 over all 2 trading rules in system\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/sysdata/data.py:58: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  dailyprice = instrprice.resample(\"1B\", how=\"last\")\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=128,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:136: FutureWarning: pd.ewm_std is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=35,min_periods=10).std(bias=False)\n",
      "  vol = pd.ewmstd(x, span=days, min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:143: FutureWarning: pd.rolling_quantile is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=100,window=500).quantile(quantile=0.05)\n",
      "  vol, floor_days, floor_min_quant, floor_min_periods)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=8,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n",
      "/home/chris/src/pysystemtrade/systems/forecast_combine.py:389: FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(adjust=True,ignore_na=False,com=125,min_periods=0).mean()\n",
      "  forecast_weights = pd.ewma(forecast_weights, weighting)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            ewmac32  ewmac8\n",
      "2016-11-07      0.5     0.5\n",
      "2016-11-08      0.5     0.5\n",
      "2016-11-09      0.5     0.5\n",
      "2016-11-10      0.5     0.5\n",
      "2016-11-11      0.5     0.5\n",
      "2016-11-07    1.0\n",
      "2016-11-08    1.0\n",
      "2016-11-09    1.0\n",
      "2016-11-10    1.0\n",
      "2016-11-11    1.0\n",
      "Freq: B, dtype: float64\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:23: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  avg_daily = float(norm_x.diff().abs().resample(\"1B\", how=\"sum\").mean())\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Only this set of rules ['ewmac32'] is cheap enough to trade for EDOLLAR\n",
      "Only this set of rules ['ewmac32', 'ewmac8'] is cheap enough to trade for CORN\n",
      "Only this set of rules ['ewmac32', 'ewmac8'] is cheap enough to trade for SP500\n",
      "Only this set of rules ['ewmac32', 'ewmac8'] is cheap enough to trade for US10\n",
      "Calculating raw forecast weights for EDOLLAR, over EDOLLAR\n",
      "Calculating pandl for instrument rules for EDOLLAR\n",
      "Calculating pandl for instrument forecast for EDOLLAR ewmac32\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/accounting.py:555: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  daily_returns = returns_df.resample(\"1B\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:556: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  weekly_returns = returns_df.resample(\"W\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:557: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  monthly_returns = returns_df.resample(\"MS\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:558: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  annual_returns = returns_df.resample(\"A\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/optimisation.py:144: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  data_item in data_gross]\n",
      "/home/chris/src/pysystemtrade/syscore/optimisation.py:147: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  data_item in data_costs]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using cost multiplier on optimisation of 0.00\n",
      "Optimising...\n",
      "Optimising for data from 1983-10-02 00:00:00 to 1984-10-31 00:00:00\n",
      "Optimising for data from 1984-10-31 00:00:00 to 1985-10-31 00:00:00\n",
      "Optimising for data from 1985-10-31 00:00:00 to 1986-10-31 00:00:00\n",
      "Optimising for data from 1986-10-31 00:00:00 to 1987-10-31 00:00:00\n",
      "Optimising for data from 1987-10-31 00:00:00 to 1988-10-31 00:00:00\n",
      "Optimising for data from 1988-10-31 00:00:00 to 1989-10-31 00:00:00\n",
      "Optimising for data from 1989-10-31 00:00:00 to 1990-10-31 00:00:00\n",
      "Optimising for data from 1990-10-31 00:00:00 to 1991-10-31 00:00:00\n",
      "Optimising for data from 1991-10-31 00:00:00 to 1992-10-31 00:00:00\n",
      "Optimising for data from 1992-10-31 00:00:00 to 1993-10-31 00:00:00\n",
      "Optimising for data from 1993-10-31 00:00:00 to 1994-10-31 00:00:00\n",
      "Optimising for data from 1994-10-31 00:00:00 to 1995-10-31 00:00:00\n",
      "Optimising for data from 1995-10-31 00:00:00 to 1996-10-31 00:00:00\n",
      "Optimising for data from 1996-10-31 00:00:00 to 1997-10-31 00:00:00\n",
      "Optimising for data from 1997-10-31 00:00:00 to 1998-10-31 00:00:00\n",
      "Optimising for data from 1998-10-31 00:00:00 to 1999-10-31 00:00:00\n",
      "Optimising for data from 1999-10-31 00:00:00 to 2000-10-31 00:00:00\n",
      "Optimising for data from 2000-10-31 00:00:00 to 2001-10-31 00:00:00\n",
      "Optimising for data from 2001-10-31 00:00:00 to 2002-10-31 00:00:00\n",
      "Optimising for data from 2002-10-31 00:00:00 to 2003-10-31 00:00:00\n",
      "Optimising for data from 2003-10-31 00:00:00 to 2004-10-31 00:00:00\n",
      "Optimising for data from 2004-10-31 00:00:00 to 2005-10-31 00:00:00\n",
      "Optimising for data from 2005-10-31 00:00:00 to 2006-10-31 00:00:00\n",
      "Optimising for data from 2006-10-31 00:00:00 to 2007-10-31 00:00:00\n",
      "Optimising for data from 2007-10-31 00:00:00 to 2008-10-31 00:00:00\n",
      "Optimising for data from 2008-10-31 00:00:00 to 2009-10-31 00:00:00\n",
      "Optimising for data from 2009-10-31 00:00:00 to 2010-10-31 00:00:00\n",
      "Optimising for data from 2010-10-31 00:00:00 to 2011-10-31 00:00:00\n",
      "Optimising for data from 2011-10-31 00:00:00 to 2012-10-31 00:00:00\n",
      "Optimising for data from 2012-10-31 00:00:00 to 2013-10-31 00:00:00\n",
      "Optimising for data from 2013-10-31 00:00:00 to 2014-10-31 00:00:00\n",
      "Optimising for data from 2014-10-31 00:00:00 to 2015-10-31 00:00:00\n",
      "Optimising for data from 2015-10-31 00:00:00 to 2016-10-31 00:00:00\n",
      "Optimising for data from 2016-10-31 00:00:00 to 2016-11-13 00:00:00\n",
      "Applying cost weighting to optimisation results\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/forecast_combine.py:389: FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(adjust=True,ignore_na=False,com=125,min_periods=0).mean()\n",
      "  forecast_weights = pd.ewma(forecast_weights, weighting)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:280: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  data = data.resample(frequency, how=\"last\")\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            ewmac32\n",
      "2016-11-07      1.0\n",
      "2016-11-08      1.0\n",
      "2016-11-09      1.0\n",
      "2016-11-10      1.0\n",
      "2016-11-11      1.0\n",
      "Calculating forecast div multiplier for EDOLLAR\n",
      "Calculating forecast correlations over EDOLLAR\n",
      "Correlation estimate\n",
      "Estimating from 1983-10-02 00:00:00 to 1984-10-31 00:00:00\n",
      "Estimating from 1984-10-31 00:00:00 to 1985-10-31 00:00:00\n",
      "Estimating from 1985-10-31 00:00:00 to 1986-10-31 00:00:00\n",
      "Estimating from 1986-10-31 00:00:00 to 1987-10-31 00:00:00\n",
      "Estimating from 1987-10-31 00:00:00 to 1988-10-31 00:00:00\n",
      "Estimating from 1988-10-31 00:00:00 to 1989-10-31 00:00:00\n",
      "Estimating from 1989-10-31 00:00:00 to 1990-10-31 00:00:00\n",
      "Estimating from 1990-10-31 00:00:00 to 1991-10-31 00:00:00\n",
      "Estimating from 1991-10-31 00:00:00 to 1992-10-31 00:00:00\n",
      "Estimating from 1992-10-31 00:00:00 to 1993-10-31 00:00:00\n",
      "Estimating from 1993-10-31 00:00:00 to 1994-10-31 00:00:00\n",
      "Estimating from 1994-10-31 00:00:00 to 1995-10-31 00:00:00\n",
      "Estimating from 1995-10-31 00:00:00 to 1996-10-31 00:00:00\n",
      "Estimating from 1996-10-31 00:00:00 to 1997-10-31 00:00:00\n",
      "Estimating from 1997-10-31 00:00:00 to 1998-10-31 00:00:00\n",
      "Estimating from 1998-10-31 00:00:00 to 1999-10-31 00:00:00\n",
      "Estimating from 1999-10-31 00:00:00 to 2000-10-31 00:00:00\n",
      "Estimating from 2000-10-31 00:00:00 to 2001-10-31 00:00:00\n",
      "Estimating from 2001-10-31 00:00:00 to 2002-10-31 00:00:00\n",
      "Estimating from 2002-10-31 00:00:00 to 2003-10-31 00:00:00\n",
      "Estimating from 2003-10-31 00:00:00 to 2004-10-31 00:00:00\n",
      "Estimating from 2004-10-31 00:00:00 to 2005-10-31 00:00:00\n",
      "Estimating from 2005-10-31 00:00:00 to 2006-10-31 00:00:00\n",
      "Estimating from 2006-10-31 00:00:00 to 2007-10-31 00:00:00\n",
      "Estimating from 2007-10-31 00:00:00 to 2008-10-31 00:00:00\n",
      "Estimating from 2008-10-31 00:00:00 to 2009-10-31 00:00:00\n",
      "Estimating from 2009-10-31 00:00:00 to 2010-10-31 00:00:00\n",
      "Estimating from 2010-10-31 00:00:00 to 2011-10-31 00:00:00\n",
      "Estimating from 2011-10-31 00:00:00 to 2012-10-31 00:00:00\n",
      "Estimating from 2012-10-31 00:00:00 to 2013-10-31 00:00:00\n",
      "Estimating from 2013-10-31 00:00:00 to 2014-10-31 00:00:00\n",
      "Estimating from 2014-10-31 00:00:00 to 2015-10-31 00:00:00\n",
      "Estimating from 2015-10-31 00:00:00 to 2016-10-31 00:00:00\n",
      "Estimating from 2016-10-31 00:00:00 to 2016-11-13 00:00:00\n",
      "2016-11-07    1.0\n",
      "2016-11-08    1.0\n",
      "2016-11-09    1.0\n",
      "2016-11-10    1.0\n",
      "2016-11-11    1.0\n",
      "Freq: B, dtype: float64\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/divmultipliers.py:94: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=125,min_periods=0).mean()\n",
      "  div_mult_df = pd.ewma(div_mult_df, span=ewma_span)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Loading csv data for EDOLLAR\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/sysdata/data.py:58: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  dailyprice = instrprice.resample(\"1B\", how=\"last\")\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=128,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:136: FutureWarning: pd.ewm_std is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=35,min_periods=10).std(bias=False)\n",
      "  vol = pd.ewmstd(x, span=days, min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:143: FutureWarning: pd.rolling_quantile is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=100,window=500).quantile(quantile=0.05)\n",
      "  vol, floor_days, floor_min_quant, floor_min_periods)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Loading csv data for EDOLLAR\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=8,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating diversification multiplier for EDOLLAR\n",
      "Adding config defaults\n",
      "Loading csv data for EDOLLAR\n",
      "2016-11-07    0.041016\n",
      "2016-11-08    0.040556\n",
      "2016-11-09    0.061289\n",
      "2016-11-10    0.065830\n",
      "2016-11-11    0.064155\n",
      "Freq: B, dtype: float64\n",
      "Getting block value for EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Loading csv instrument config\n",
      "2016-11-07    2464.0000\n",
      "2016-11-08    2462.7500\n",
      "2016-11-09    2457.3750\n",
      "2016-11-10    2454.0000\n",
      "2016-11-11    2452.9375\n",
      "Freq: B, Name: price, dtype: float64\n",
      "Loading csv data for EDOLLAR\n",
      "Loading csv instrument config\n",
      "(1983-09-26    71.131192\n",
      "1983-09-27    71.021192\n",
      "1983-09-28    70.971192\n",
      "1983-09-29    70.951192\n",
      "1983-09-30    70.991192\n",
      "1983-10-03    71.021192\n",
      "1983-10-04    71.021192\n",
      "1983-10-05    71.081192\n",
      "1983-10-06    71.091192\n",
      "1983-10-07    71.101192\n",
      "1983-10-10    71.101192\n",
      "1983-10-11    70.951192\n",
      "1983-10-12    70.991192\n",
      "1983-10-13    70.951192\n",
      "1983-10-14    71.011192\n",
      "1983-10-17    71.141192\n",
      "1983-10-18    71.091192\n",
      "1983-10-19    71.091192\n",
      "1983-10-20    71.051192\n",
      "1983-10-21    71.051192\n",
      "1983-10-24    70.941192\n",
      "1983-10-25    70.921192\n",
      "1983-10-26    70.921192\n",
      "1983-10-27    70.931192\n",
      "1983-10-28    70.901192\n",
      "1983-10-31    70.851192\n",
      "1983-11-01    70.831192\n",
      "1983-11-02    70.831192\n",
      "1983-11-03    70.731192\n",
      "1983-11-04    70.561192\n",
      "                ...    \n",
      "2016-10-03    98.700000\n",
      "2016-10-04    98.645000\n",
      "2016-10-05    98.625000\n",
      "2016-10-06    98.580000\n",
      "2016-10-07    98.610000\n",
      "2016-10-10    98.545000\n",
      "2016-10-11    98.560000\n",
      "2016-10-12    98.575000\n",
      "2016-10-13    98.610000\n",
      "2016-10-14    98.575000\n",
      "2016-10-17    98.605000\n",
      "2016-10-18    98.632500\n",
      "2016-10-19    98.645000\n",
      "2016-10-20    98.610000\n",
      "2016-10-21    98.630000\n",
      "2016-10-24    98.590000\n",
      "2016-10-25    98.590000\n",
      "2016-10-26    98.555000\n",
      "2016-10-27    98.505000\n",
      "2016-10-28    98.535000\n",
      "2016-10-31    98.545000\n",
      "2016-11-01    98.575000\n",
      "2016-11-02    98.600000\n",
      "2016-11-03    98.595000\n",
      "2016-11-04    98.625000\n",
      "2016-11-07    98.560000\n",
      "2016-11-08    98.510000\n",
      "2016-11-09    98.295000\n",
      "2016-11-10    98.160000\n",
      "2016-11-11    98.117500\n",
      "Freq: B, Name: price, dtype: float64, 2500)\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting fx rates for EDOLLAR\n",
      "Getting vol target\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "2040-12-04   NaN\n",
      "2040-12-05   NaN\n",
      "2040-12-06   NaN\n",
      "2040-12-07   NaN\n",
      "2040-12-10   NaN\n",
      "dtype: float64\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "2040-12-04   NaN\n",
      "2040-12-05   NaN\n",
      "2040-12-06   NaN\n",
      "2040-12-07   NaN\n",
      "2040-12-10   NaN\n",
      "dtype: float64\n",
      "{'daily_cash_vol_target': 7812.5, 'percentage_vol_target': 25.0, 'notional_trading_capital': 500000.0, 'annual_cash_vol_target': 125000.0, 'base_currency': 'GBP'}\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "2016-11-07   -17.491603\n",
      "2016-11-08   -26.428721\n",
      "2016-11-09   -26.687302\n",
      "2016-11-10   -39.665070\n",
      "2016-11-11   -57.253173\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating instrument weights\n",
      "Getting raw instrument weights\n",
      "Calculating raw instrument weights\n",
      "Cost multiplier of 0.0 will be ignored as equalising SR in optimisation (equalise_SR=True)\n",
      "Zero cost multiplier and not applying cost weightings - so costs won't be used at all\n",
      "Cost multiplier of %2.f is less than one and not applying cost weightings - effect of costs may be underestimated\n",
      "Getting vol target\n",
      "Calculating pandl for subsystem for instrument CORN\n",
      "Loading csv data for CORN\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Getting block value for CORN\n",
      "Loading csv data for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv data for CORN\n",
      "Getting fx rates for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating raw forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Loading csv data for CORN\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Loading csv data for CORN\n",
      "Calculating diversification multiplier for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/accounting.py:555: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  daily_returns = returns_df.resample(\"1B\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:556: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  weekly_returns = returns_df.resample(\"W\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:557: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  monthly_returns = returns_df.resample(\"MS\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:558: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  annual_returns = returns_df.resample(\"A\", how=\"sum\")\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating pandl for subsystem for instrument EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting block value for EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv data for EDOLLAR\n",
      "Getting fx rates for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n",
      "Calculating pandl for subsystem for instrument SP500\n",
      "Loading csv data for SP500\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Getting block value for SP500\n",
      "Loading csv data for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv data for SP500\n",
      "Getting fx rates for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating raw forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Loading csv data for SP500\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Loading csv data for SP500\n",
      "Calculating diversification multiplier for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n",
      "Calculating pandl for subsystem for instrument US10\n",
      "Loading csv data for US10\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Getting block value for US10\n",
      "Loading csv data for US10\n",
      "Loading csv instrument config\n",
      "Loading csv data for US10\n",
      "Getting fx rates for US10\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating raw forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Loading csv data for US10\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Loading csv data for US10\n",
      "Calculating diversification multiplier for US10\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/optimisation.py:144: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  data_item in data_gross]\n",
      "/home/chris/src/pysystemtrade/syscore/optimisation.py:147: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  data_item in data_costs]\n",
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:23: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  avg_daily = float(norm_x.diff().abs().resample(\"1B\", how=\"sum\").mean())\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using cost multiplier on optimisation of 0.00\n",
      "Optimising...\n",
      "Optimising for data from 1981-09-27 00:00:00 to 2016-11-13 00:00:00\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/portfolio.py:243: FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(adjust=True,ignore_na=False,com=125,min_periods=0).mean()\n",
      "  instrument_weights = pd.ewma(instrument_weights, weighting)\n",
      "/home/chris/src/pysystemtrade/systems/portfolio.py:663: FutureWarning: \n",
      ".resample() is now a deferred operation\n",
      "You called diff(...) on this deferred object which materialized it into a dataframe\n",
      "by implicitly taking the mean.  Use .resample(...).mean() instead\n",
      "  pandl = pandl.cumsum().resample(frequency).diff()\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:280: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  data = data.resample(frequency, how=\"last\")\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:181: RuntimeWarning: invalid value encountered in less\n",
      "  corrmat[corrmat < 0] = 0.0\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                CORN   EDOLLAR     SP500      US10\n",
      "2016-11-07  0.274523  0.246297  0.279745  0.199436\n",
      "2016-11-08  0.274523  0.246297  0.279745  0.199436\n",
      "2016-11-09  0.274523  0.246297  0.279745  0.199436\n",
      "2016-11-10  0.274523  0.246297  0.279745  0.199436\n",
      "2016-11-11  0.274523  0.246297  0.279745  0.199436\n",
      "Calculating instrument div. multiplier\n",
      "Calculating instrument correlations\n",
      "Correlation estimate\n",
      "Estimating from 1981-09-27 00:00:00 to 1982-09-30 00:00:00\n",
      "Estimating from 1982-09-30 00:00:00 to 1983-09-30 00:00:00\n",
      "Estimating from 1983-09-30 00:00:00 to 1984-09-30 00:00:00\n",
      "Estimating from 1984-09-30 00:00:00 to 1985-09-30 00:00:00\n",
      "Estimating from 1985-09-30 00:00:00 to 1986-09-30 00:00:00\n",
      "Estimating from 1986-09-30 00:00:00 to 1987-09-30 00:00:00\n",
      "Estimating from 1987-09-30 00:00:00 to 1988-09-30 00:00:00\n",
      "Estimating from 1988-09-30 00:00:00 to 1989-09-30 00:00:00\n",
      "Estimating from 1989-09-30 00:00:00 to 1990-09-30 00:00:00\n",
      "Estimating from 1990-09-30 00:00:00 to 1991-09-30 00:00:00\n",
      "Estimating from 1991-09-30 00:00:00 to 1992-09-30 00:00:00\n",
      "Estimating from 1992-09-30 00:00:00 to 1993-09-30 00:00:00\n",
      "Estimating from 1993-09-30 00:00:00 to 1994-09-30 00:00:00\n",
      "Estimating from 1994-09-30 00:00:00 to 1995-09-30 00:00:00\n",
      "Estimating from 1995-09-30 00:00:00 to 1996-09-30 00:00:00\n",
      "Estimating from 1996-09-30 00:00:00 to 1997-09-30 00:00:00\n",
      "Estimating from 1997-09-30 00:00:00 to 1998-09-30 00:00:00\n",
      "Estimating from 1998-09-30 00:00:00 to 1999-09-30 00:00:00\n",
      "Estimating from 1999-09-30 00:00:00 to 2000-09-30 00:00:00\n",
      "Estimating from 2000-09-30 00:00:00 to 2001-09-30 00:00:00\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:181: RuntimeWarning: invalid value encountered in less\n",
      "  corrmat[corrmat < 0] = 0.0\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:181: RuntimeWarning: invalid value encountered in less\n",
      "  corrmat[corrmat < 0] = 0.0\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:181: RuntimeWarning: invalid value encountered in less\n",
      "  corrmat[corrmat < 0] = 0.0\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:181: RuntimeWarning: invalid value encountered in less\n",
      "  corrmat[corrmat < 0] = 0.0\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:181: RuntimeWarning: invalid value encountered in less\n",
      "  corrmat[corrmat < 0] = 0.0\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:181: RuntimeWarning: invalid value encountered in less\n",
      "  corrmat[corrmat < 0] = 0.0\n",
      "/home/chris/src/pysystemtrade/syscore/correlations.py:170: FutureWarning: pd.ewm_corr is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(span=500,ignore_na=False,min_periods=20,adjust=True).corr(pairwise=True,other=<DataFrame>)\n",
      "  min_periods=min_periods)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Estimating from 2001-09-30 00:00:00 to 2002-09-30 00:00:00\n",
      "Estimating from 2002-09-30 00:00:00 to 2003-09-30 00:00:00\n",
      "Estimating from 2003-09-30 00:00:00 to 2004-09-30 00:00:00\n",
      "Estimating from 2004-09-30 00:00:00 to 2005-09-30 00:00:00\n",
      "Estimating from 2005-09-30 00:00:00 to 2006-09-30 00:00:00\n",
      "Estimating from 2006-09-30 00:00:00 to 2007-09-30 00:00:00\n",
      "Estimating from 2007-09-30 00:00:00 to 2008-09-30 00:00:00\n",
      "Estimating from 2008-09-30 00:00:00 to 2009-09-30 00:00:00\n",
      "Estimating from 2009-09-30 00:00:00 to 2010-09-30 00:00:00\n",
      "Estimating from 2010-09-30 00:00:00 to 2011-09-30 00:00:00\n",
      "Estimating from 2011-09-30 00:00:00 to 2012-09-30 00:00:00\n",
      "Estimating from 2012-09-30 00:00:00 to 2013-09-30 00:00:00\n",
      "Estimating from 2013-09-30 00:00:00 to 2014-09-30 00:00:00\n",
      "Estimating from 2014-09-30 00:00:00 to 2015-09-30 00:00:00\n",
      "Estimating from 2015-09-30 00:00:00 to 2016-09-30 00:00:00\n",
      "Estimating from 2016-09-30 00:00:00 to 2016-11-13 00:00:00\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/divmultipliers.py:94: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=125,min_periods=0).mean()\n",
      "  div_mult_df = pd.ewma(div_mult_df, span=ewma_span)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2016-11-07    1.677346\n",
      "2016-11-08    1.677321\n",
      "2016-11-09    1.677296\n",
      "2016-11-10    1.677272\n",
      "2016-11-11    1.677248\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Getting block value for CORN\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/sysdata/data.py:58: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  dailyprice = instrprice.resample(\"1B\", how=\"last\")\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading csv instrument config\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/algos.py:136: FutureWarning: pd.ewm_std is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=35,min_periods=10).std(bias=False)\n",
      "  vol = pd.ewmstd(x, span=days, min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:143: FutureWarning: pd.rolling_quantile is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=100,window=500).quantile(quantile=0.05)\n",
      "  vol, floor_days, floor_min_quant, floor_min_periods)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Getting fx rates for CORN\n",
      "Getting vol target\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating raw forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=128,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=8,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n",
      "/home/chris/src/pysystemtrade/systems/forecast_combine.py:389: FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(adjust=True,ignore_na=False,com=125,min_periods=0).mean()\n",
      "  forecast_weights = pd.ewma(forecast_weights, weighting)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating diversification multiplier for CORN\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting block value for EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv data for EDOLLAR\n",
      "Getting fx rates for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Getting block value for SP500\n",
      "Loading csv data for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv data for SP500\n",
      "Getting fx rates for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating raw forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Loading csv data for SP500\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Loading csv data for SP500\n",
      "Calculating diversification multiplier for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Getting block value for US10\n",
      "Loading csv data for US10\n",
      "Loading csv instrument config\n",
      "Loading csv data for US10\n",
      "Getting fx rates for US10\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating raw forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Loading csv data for US10\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Loading csv data for US10\n",
      "Calculating diversification multiplier for US10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/portfolio.py:243: FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(adjust=True,ignore_na=False,com=125,min_periods=0).mean()\n",
      "  instrument_weights = pd.ewma(instrument_weights, weighting)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2016-11-07   -10.494962\n",
      "2016-11-08   -15.857233\n",
      "2016-11-09   -16.012381\n",
      "2016-11-10   -23.799042\n",
      "2016-11-11   -34.351904\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating pandl for portfolio\n",
      "Getting vol target\n",
      "Calculating pandl for instrument for CORN\n",
      "Loading csv data for CORN\n",
      "Calculating buffered positions\n",
      "Calculating notional position for CORN\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Getting block value for CORN\n",
      "Loading csv data for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv data for CORN\n",
      "Getting fx rates for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating raw forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Loading csv data for CORN\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Loading csv data for CORN\n",
      "Calculating diversification multiplier for CORN\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting block value for EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv data for EDOLLAR\n",
      "Getting fx rates for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Getting block value for SP500\n",
      "Loading csv data for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv data for SP500\n",
      "Getting fx rates for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating raw forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Loading csv data for SP500\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Loading csv data for SP500\n",
      "Calculating diversification multiplier for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Getting block value for US10\n",
      "Loading csv data for US10\n",
      "Loading csv instrument config\n",
      "Loading csv data for US10\n",
      "Getting fx rates for US10\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating raw forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Loading csv data for US10\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Loading csv data for US10\n",
      "Calculating diversification multiplier for US10\n",
      "Calculating buffers for CORN\n",
      "Calculating position method buffer for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/accounting.py:555: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  daily_returns = returns_df.resample(\"1B\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:556: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  weekly_returns = returns_df.resample(\"W\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:557: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  monthly_returns = returns_df.resample(\"MS\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/accounting.py:558: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  annual_returns = returns_df.resample(\"A\", how=\"sum\")\n",
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:23: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).sum()\n",
      "  avg_daily = float(norm_x.diff().abs().resample(\"1B\", how=\"sum\").mean())\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating pandl for instrument for EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating buffered positions\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating buffers for EDOLLAR\n",
      "Calculating position method buffer for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n",
      "Calculating pandl for instrument for SP500\n",
      "Loading csv data for SP500\n",
      "Calculating buffered positions\n",
      "Calculating notional position for SP500\n",
      "Calculating buffers for SP500\n",
      "Calculating position method buffer for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n",
      "Calculating pandl for instrument for US10\n",
      "Loading csv data for US10\n",
      "Calculating buffered positions\n",
      "Calculating notional position for US10\n",
      "Calculating buffers for US10\n",
      "Calculating position method buffer for US10\n",
      "Loading csv instrument config\n",
      "Loading csv cost file\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:224: FutureWarning: pd.rolling_max is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=1,window=9166).max()\n",
      "  maxx = pd.rolling_max(x, len(x), min_periods=1)\n",
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:224: FutureWarning: pd.rolling_max is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=1,window=9166).max()\n",
      "  maxx = pd.rolling_max(x, len(x), min_periods=1)\n",
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:224: FutureWarning: pd.rolling_max is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=1,window=9166).max()\n",
      "  maxx = pd.rolling_max(x, len(x), min_periods=1)\n",
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:224: FutureWarning: pd.rolling_max is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=1,window=9166).max()\n",
      "  maxx = pd.rolling_max(x, len(x), min_periods=1)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[('min', '-12.17'), ('max', '13.55'), ('median', '-0.0004523'), ('mean', '0.05236'), ('std', '1.684'), ('skew', '-0.1392'), ('ann_mean', '13.4'), ('ann_std', '26.94'), ('sharpe', '0.4975'), ('sortino', '0.6471'), ('avg_drawdown', '-20.81'), ('time_in_drawdown', '0.9682'), ('calmar', '0.2554'), ('avg_return_to_drawdown', '0.6441'), ('avg_loss', '-1.012'), ('avg_gain', '1.163'), ('gaintolossratio', '1.149'), ('profitfactor', '1.101'), ('hitrate', '0.4895'), ('t_stat', '2.546'), ('p_value', '0.01093')], ('You can also plot / print:', ['rolling_ann_std', 'drawdown', 'curve', 'percent', 'cumulative'])]\n",
      "[[('min', '-12.17'), ('max', '13.55'), ('median', '0'), ('mean', '0.05285'), ('std', '1.684'), ('skew', '-0.1392'), ('ann_mean', '13.53'), ('ann_std', '26.94'), ('sharpe', '0.5021'), ('sortino', '0.642'), ('avg_drawdown', '-20.66'), ('time_in_drawdown', '0.9657'), ('calmar', '0.2602'), ('avg_return_to_drawdown', '0.655'), ('avg_loss', '-1.121'), ('avg_gain', '1.163'), ('gaintolossratio', '1.037'), ('profitfactor', '1.102'), ('hitrate', '0.5153'), ('t_stat', '2.569'), ('p_value', '0.01021')], ('You can also plot / print:', ['rolling_ann_std', 'drawdown', 'curve', 'percent', 'cumulative'])]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:224: FutureWarning: pd.rolling_max is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=1,window=9166).max()\n",
      "  maxx = pd.rolling_max(x, len(x), min_periods=1)\n",
      "/home/chris/src/pysystemtrade/syscore/pdutils.py:224: FutureWarning: pd.rolling_max is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=1,window=9166).max()\n",
      "  maxx = pd.rolling_max(x, len(x), min_periods=1)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[('min', '-12.17'), ('max', '13.55'), ('median', '-0.0004523'), ('mean', '0.05236'), ('std', '1.684'), ('skew', '-0.1392'), ('ann_mean', '13.4'), ('ann_std', '26.94'), ('sharpe', '0.4975'), ('sortino', '0.6471'), ('avg_drawdown', '-20.81'), ('time_in_drawdown', '0.9682'), ('calmar', '0.2554'), ('avg_return_to_drawdown', '0.6441'), ('avg_loss', '-1.012'), ('avg_gain', '1.163'), ('gaintolossratio', '1.149'), ('profitfactor', '1.101'), ('hitrate', '0.4895'), ('t_stat', '2.546'), ('p_value', '0.01093')], ('You can also plot / print:', ['rolling_ann_std', 'drawdown', 'curve', 'percent', 'cumulative'])]\n",
      "Config with elements: base_currency, forecast_div_multiplier, forecast_scalars, forecast_weights, instrument_div_multiplier, instrument_weights, notional_trading_capital, percentage_vol_target, trading_rules\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Getting block value for CORN\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/sysdata/data.py:58: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).last()\n",
      "  dailyprice = instrprice.resample(\"1B\", how=\"last\")\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading csv instrument config\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/syscore/algos.py:136: FutureWarning: pd.ewm_std is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=35,min_periods=10).std(bias=False)\n",
      "  vol = pd.ewmstd(x, span=days, min_periods=min_periods)\n",
      "/home/chris/src/pysystemtrade/syscore/algos.py:143: FutureWarning: pd.rolling_quantile is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.rolling(center=False,min_periods=100,window=500).quantile(quantile=0.05)\n",
      "  vol, floor_days, floor_min_quant, floor_min_periods)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Getting fx rates for CORN\n",
      "Getting vol target\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating raw forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=128,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Loading csv data for CORN\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:37: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=8,min_periods=0).mean()\n",
      "  fast_ewma = pd.ewma(price, span=Lfast)\n",
      "/home/chris/src/pysystemtrade/systems/provided/example/rules.py:38: FutureWarning: pd.ewm_mean is deprecated for Series and will be removed in a future version, replace with \n",
      "\tSeries.ewm(adjust=True,ignore_na=False,span=32,min_periods=0).mean()\n",
      "  slow_ewma = pd.ewma(price, span=Lslow)\n",
      "/home/chris/src/pysystemtrade/systems/forecast_combine.py:389: FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(adjust=True,ignore_na=False,com=125,min_periods=0).mean()\n",
      "  forecast_weights = pd.ewma(forecast_weights, weighting)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating diversification multiplier for CORN\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting block value for EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv data for EDOLLAR\n",
      "Getting fx rates for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Loading csv data for EDOLLAR\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Getting block value for SP500\n",
      "Loading csv data for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv data for SP500\n",
      "Getting fx rates for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating raw forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Loading csv data for SP500\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Loading csv data for SP500\n",
      "Calculating diversification multiplier for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Getting block value for US10\n",
      "Loading csv data for US10\n",
      "Loading csv instrument config\n",
      "Loading csv data for US10\n",
      "Getting fx rates for US10\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating raw forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Loading csv data for US10\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Loading csv data for US10\n",
      "Calculating diversification multiplier for US10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/chris/src/pysystemtrade/systems/portfolio.py:243: FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be removed in a future version, replace with \n",
      "\tDataFrame.ewm(adjust=True,ignore_na=False,com=125,min_periods=0).mean()\n",
      "  instrument_weights = pd.ewma(instrument_weights, weighting)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2016-11-07   -10.494962\n",
      "2016-11-08   -15.857233\n",
      "2016-11-09   -16.012381\n",
      "2016-11-10   -23.799042\n",
      "2016-11-11   -34.351904\n",
      "Freq: B, dtype: float64\n",
      "Config with elements: base_currency, forecast_div_multiplier, forecast_weights, instrument_div_multiplier, instrument_weights, notional_trading_capital, percentage_vol_target, trading_rules\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Loading csv data for EDOLLAR\n",
      "2016-11-07    0.100716\n",
      "2016-11-08   -0.011247\n",
      "2016-11-09   -0.237658\n",
      "2016-11-10   -0.513974\n",
      "2016-11-11   -0.835147\n",
      "Freq: B, dtype: float64\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Loading csv data for EDOLLAR\n",
      "2016-11-07   -0.671570\n",
      "2016-11-08   -0.928725\n",
      "2016-11-09   -1.305111\n",
      "2016-11-10   -2.007488\n",
      "2016-11-11   -2.735241\n",
      "Freq: B, dtype: float64\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "2016-11-07    0.266898\n",
      "2016-11-08   -0.029803\n",
      "2016-11-09   -0.629794\n",
      "2016-11-10   -1.362031\n",
      "2016-11-11   -2.213139\n",
      "Freq: B, dtype: float64\n",
      "2.65\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating raw forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "2016-11-07   -1.810832\n",
      "2016-11-08   -2.723625\n",
      "2016-11-09   -4.150784\n",
      "2016-11-10   -6.600944\n",
      "2016-11-11   -9.190453\n",
      "Freq: B, dtype: float64\n",
      "            ewmac32  ewmac8\n",
      "2016-11-07      0.5     0.5\n",
      "2016-11-08      0.5     0.5\n",
      "2016-11-09      0.5     0.5\n",
      "2016-11-10      0.5     0.5\n",
      "2016-11-11      0.5     0.5\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting block value for EDOLLAR\n",
      "Loading csv data for EDOLLAR\n",
      "Loading csv instrument config\n",
      "Loading csv data for EDOLLAR\n",
      "Getting fx rates for EDOLLAR\n",
      "Getting vol target\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "2016-11-07   -17.491603\n",
      "2016-11-08   -26.428721\n",
      "2016-11-09   -26.687302\n",
      "2016-11-10   -39.665070\n",
      "2016-11-11   -57.253173\n",
      "Freq: B, dtype: float64\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Getting block value for CORN\n",
      "Loading csv data for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv data for CORN\n",
      "Getting fx rates for CORN\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating raw forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Loading csv data for CORN\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Loading csv data for CORN\n",
      "Calculating diversification multiplier for CORN\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Getting block value for SP500\n",
      "Loading csv data for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv data for SP500\n",
      "Getting fx rates for SP500\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating raw forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Loading csv data for SP500\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Loading csv data for SP500\n",
      "Calculating diversification multiplier for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Getting block value for US10\n",
      "Loading csv data for US10\n",
      "Loading csv instrument config\n",
      "Loading csv data for US10\n",
      "Getting fx rates for US10\n",
      "Loading csv instrument config\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Loading csv fx data\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating raw forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Loading csv data for US10\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Loading csv data for US10\n",
      "Calculating diversification multiplier for US10\n",
      "2016-11-07   -10.494962\n",
      "2016-11-08   -15.857233\n",
      "2016-11-09   -16.012381\n",
      "2016-11-10   -23.799042\n",
      "2016-11-11   -34.351904\n",
      "Freq: B, dtype: float64\n"
     ]
    }
   ],
   "source": [
    "run simplesystem.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "to_frame() got an unexpected keyword argument 'name'",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-3-0770d84b1b8f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmy_account\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mportfolio\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/home/chris/miniconda2/envs/q/lib/python3.5/site-packages/pandas/tools/plotting.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, kind, ax, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, label, secondary_y, **kwds)\u001b[0m\n\u001b[1;32m   3598\u001b[0m                            \u001b[0mcolormap\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcolormap\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtable\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtable\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0myerr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0myerr\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3599\u001b[0m                            \u001b[0mxerr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mxerr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlabel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msecondary_y\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msecondary_y\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3600\u001b[0;31m                            **kwds)\n\u001b[0m\u001b[1;32m   3601\u001b[0m     \u001b[0m__call__\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__doc__\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mplot_series\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__doc__\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3602\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/home/chris/miniconda2/envs/q/lib/python3.5/site-packages/pandas/tools/plotting.py\u001b[0m in \u001b[0;36mplot_series\u001b[0;34m(data, kind, ax, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, label, secondary_y, **kwds)\u001b[0m\n\u001b[1;32m   2672\u001b[0m                  \u001b[0myerr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0myerr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mxerr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mxerr\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2673\u001b[0m                  \u001b[0mlabel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlabel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msecondary_y\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msecondary_y\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2674\u001b[0;31m                  **kwds)\n\u001b[0m\u001b[1;32m   2675\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2676\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/home/chris/miniconda2/envs/q/lib/python3.5/site-packages/pandas/tools/plotting.py\u001b[0m in \u001b[0;36m_plot\u001b[0;34m(data, x, y, subplots, ax, kind, **kwds)\u001b[0m\n\u001b[1;32m   2468\u001b[0m         \u001b[0mplot_obj\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mklass\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubplots\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msubplots\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0max\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkind\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkind\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2469\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2470\u001b[0;31m     \u001b[0mplot_obj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2471\u001b[0m     \u001b[0mplot_obj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2472\u001b[0m     \u001b[0;32mreturn\u001b[0m \u001b[0mplot_obj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/home/chris/miniconda2/envs/q/lib/python3.5/site-packages/pandas/tools/plotting.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m   1039\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1040\u001b[0m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_args_adjust\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1041\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compute_plot_data\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1042\u001b[0m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_setup_subplots\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1043\u001b[0m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_make_plot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/home/chris/miniconda2/envs/q/lib/python3.5/site-packages/pandas/tools/plotting.py\u001b[0m in \u001b[0;36m_compute_plot_data\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m   1136\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mlabel\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1137\u001b[0m                 \u001b[0mlabel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'None'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1138\u001b[0;31m             \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_frame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlabel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1139\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1140\u001b[0m         \u001b[0mnumeric_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_convert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdatetime\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_numeric_data\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mTypeError\u001b[0m: to_frame() got an unexpected keyword argument 'name'"
     ],
     "output_type": "error"
    }
   ],
   "source": [
    "my_account.portfolio().plot()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3.0
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}